package com.cn.sinsosft.boot.controller;

import com.cn.sinsosft.boot.entity.User;
import com.cn.sinsosft.boot.service.UploadService;
import com.cn.sinsosft.boot.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author wangyupeng
 * @despriction:
 * @ate:Created in 18:31 2019/1/10
 * @modify By:
 */
@Controller
@RequestMapping(value = "/dev")
@Slf4j
@Api(tags = "用户管理")
public class UserController {

    @Resource
    private UserService userService;
    @Resource
    private UploadService uploadService;

    @RequestMapping(value = "/upload", method = RequestMethod.POST)
    public String upload(MultipartFile fileUpload){
        String login = uploadService.upload(fileUpload);
        return login;
    }

    @RequestMapping("/toLogin")
    public String toLogin(){
        return "login";
    }
    @ApiOperation(value="获取用户名和密码", notes="获取用户名和密码")
    @RequestMapping("login")
    public String login(User user){
        String str= userService.login(user);
        return str;
    }
}